<html>
<head><meta charset="utf-8"><title>issue-51351 · t-compiler/wg-nll · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/index.html">t-compiler/wg-nll</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html">issue-51351</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="129591338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129591338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129591338">(Jul 13 2018 at 09:47)</a>:</h4>
<p>Hi, I'm trying to fix <a href="https://github.com/rust-lang/rust/issues/51351" target="_blank" title="https://github.com/rust-lang/rust/issues/51351">https://github.com/rust-lang/rust/issues/51351</a>, and would like to discuss it with some one, <span class="user-mention" data-user-id="116009">@nikomatsakis</span>  left comments, but looks like he is not around.</p>



<a name="129591572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129591572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129591572">(Jul 13 2018 at 09:54)</a>:</h4>
<p>hi <span class="user-mention" data-user-id="116925">@mikhail-m1</span> welcome here.  Niko is on vacation these days so he isn't online for long periods. Dont' worry, he will reply you here when he is online.</p>



<a name="129611037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129611037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129611037">(Jul 13 2018 at 16:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> I'm around a bit -- feel free to leave questions, and/or open a [WIP] PR</p>



<a name="129759245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129759245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129759245">(Jul 16 2018 at 15:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  I added comments to my fix <a href="https://github.com/mikhail-m1/rust/commit/f391ec585622673bddd5d0d30a0831910c7844dc" target="_blank" title="https://github.com/mikhail-m1/rust/commit/f391ec585622673bddd5d0d30a0831910c7844dc">https://github.com/mikhail-m1/rust/commit/f391ec585622673bddd5d0d30a0831910c7844dc</a> , It will be great if you share your thoughts</p>



<a name="129759309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129759309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129759309">(Jul 16 2018 at 16:00)</a>:</h4>
<p>it's to ugly to create PR...</p>



<a name="129759455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129759455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129759455">(Jul 16 2018 at 16:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> ok I sort of forget the context but will take a look!</p>



<a name="129759459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129759459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129759459">(Jul 16 2018 at 16:03)</a>:</h4>
<p>ah yes, <em>that</em> problem.</p>



<a name="129759462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129759462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129759462">(Jul 16 2018 at 16:03)</a>:</h4>
<p>/me shudders</p>



<a name="129762033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129762033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129762033">(Jul 16 2018 at 16:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> ok so I read the diffs, now I have to refresh my memory from the issue itself :)</p>



<a name="129762085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129762085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129762085">(Jul 16 2018 at 16:49)</a>:</h4>
<p>ok right so this is the "simple case" of the problem I think...</p>



<a name="129776006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129776006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129776006">(Jul 16 2018 at 21:09)</a>:</h4>
<p>I don't understand why for <code>fn with_signature&lt;'a, T, F&gt;(cell: Cell&lt;&amp;'a ()&gt;, t: T, op: F)</code> <code>rustc::middle::resolve_lifetime: insert_late_bound_lifetimes: lifetime T#0 with id NodeId(17) is late-bound</code> and same for F, but T and F are not lifetimes</p>



<a name="129791258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129791258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129791258">(Jul 17 2018 at 03:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> so, <em>that</em> example is the more complex one I think</p>



<a name="129791263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129791263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129791263">(Jul 17 2018 at 03:31)</a>:</h4>
<p>that is, there are two cases</p>



<a name="129791272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129791272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129791272">(Jul 17 2018 at 03:31)</a>:</h4>
<p>the simplest case is the one that people reduced the ICE to:</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="mi">22</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>Here, <code>'a</code> is not used <strong>anywhere</strong> in the signature.</p>



<a name="129791314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129791314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129791314">(Jul 17 2018 at 03:32)</a>:</h4>
<p>This is the one I was targeting initially.</p>



<a name="129791323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129791323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129791323">(Jul 17 2018 at 03:32)</a>:</h4>
<p>Sorry I didn't get back to you last night, ran out of time.</p>



<a name="129791556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129791556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129791556">(Jul 17 2018 at 03:38)</a>:</h4>
<p>but I think it's probably worth talking through the closure case</p>



<a name="129791574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129791574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129791574">(Jul 17 2018 at 03:39)</a>:</h4>
<p>that said, I can't really do that right now, I'll be back in ~7 hours or something :)</p>



<a name="129801823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129801823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129801823">(Jul 17 2018 at 08:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  yes, my changes don't fix next ICE, trying find why   </p>
<div class="codehilite"><pre><span></span>fn produce&lt;&#39;a&gt;() {
    move || { let x: &amp;&#39;a () = &amp;(); };
}
</pre></div>



<a name="129805568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129805568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129805568">(Jul 17 2018 at 10:28)</a>:</h4>
<p>I've verified my assumption, for the closure  <code>tcx.is_late_bound_map</code> returns None, we need to find another way to get late bound regions</p>



<a name="129807482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129807482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129807482">(Jul 17 2018 at 11:23)</a>:</h4>
<p>yeah... I think I know why they don't fix it :) but I have to think about <em>how</em> to best fix it</p>



<a name="129935066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129935066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129935066">(Jul 19 2018 at 14:29)</a>:</h4>
<p>hi <span class="user-mention" data-user-id="116009">@nikomatsakis</span>  i found a way to fix the closure case by get up by calling hir.get_parent_node(..), and add late_bound regions for parent too, <br>
but your comment about add it to <code>ClosureRegionRequirements</code> looks better, but I need more details to start and an example for tests propagation to parent</p>



<a name="129935211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129935211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129935211">(Jul 19 2018 at 14:31)</a>:</h4>
<p>argh I forgot to get back to you on this, yes. Just added it to my to-do list for today to write up something</p>



<a name="129945941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129945941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129945941">(Jul 19 2018 at 17:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> how much have you looked at the <code>ClosureRegionRequirements</code> code? i.e., you get the basic idea of it?</p>



<a name="129957489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129957489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129957489">(Jul 19 2018 at 21:16)</a>:</h4>
<p>I left some notes <a href="https://github.com/rust-lang/rust/issues/52113#issuecomment-406417018" target="_blank" title="https://github.com/rust-lang/rust/issues/52113#issuecomment-406417018">in a github comment</a> <span class="user-mention" data-user-id="116925">@mikhail-m1</span> -- not sure if they are helpful or not -- let me know and I will try to elaborate. =) At least I worked through what I think should happen in my own head, though, and I think it should all work out.</p>



<a name="129984715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129984715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129984715">(Jul 20 2018 at 08:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  thanks for helpful comment, just two questions:<br>
1. What should i do with 51351? I can create PR from <a href="https://github.com/mikhail-m1/rust/commit/f391ec585622673bddd5d0d30a0831910c7844dc" target="_blank" title="https://github.com/mikhail-m1/rust/commit/f391ec585622673bddd5d0d30a0831910c7844dc">commit</a> but it doesn't look right:</p>
<ul>
<li>add generic types as regions (because middle treat them  as late_region)  </li>
<li>create <code>region, FreeRegion, BrRegion</code>.</li>
<li>Is order of how function processed is determinate? Are closures processed first?</li>
</ul>



<a name="129988000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/129988000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#129988000">(Jul 20 2018 at 10:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> you can create a 'WIP' PR (put [WIP] in the title of the PR so people know you are working on it). Becomes easy for people to review it.</p>



<a name="130038064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130038064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130038064">(Jul 21 2018 at 04:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> first off, <span class="user-mention" data-user-id="120823">@DPC</span> is right that a <code>[WIP]</code> PR is often very helpful. </p>
<p>To answer your questions:</p>
<blockquote>
<p>Is order of how function processed is determinate? Are closures processed first?</p>
</blockquote>
<p>Sort of — closures will always <strong>finish</strong> being processed first, at least. This is because the closure's creator will invoke the <code>mir_borrowck</code> query on each closure that appears within its function body in order to get the <code>ClosureRegionRequirements</code>.</p>
<blockquote>
<p>create region, FreeRegion, BrRegion</p>
</blockquote>
<p>I don't quite understand what you mean by this -- oh, you mean create one of those for each late-bound-region on the fn -- this sounds roughly right, yes. One thing to be careful of though is that we <strong>already</strong> have late-bound regions for things that appear in the fn arguments etc. For example:</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>in that case, <code>'a</code> is a LBR, but we will have created a corresponding universal region for it already. So I guess we want to check the table for that to see if there is already an entry.</p>
<blockquote>
<p>What should i do with 51351?</p>
</blockquote>
<p>I think a <code>[WIP]</code> PR is a good idea --  it seems like addressing the case of <code>fn foo&lt;'a&gt;() { let x: &amp;'a u32 = ...; }</code> is a good starting point in any case for the more complex problem, since it too requires enumerating the late-bound regions. Though there are <em>some</em> differences (e.g., in the closure case, we won't have entries for <em>any</em> late-bound regions from the enclosing fn's signature, I don't think).</p>



<a name="130153301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130153301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130153301">(Jul 23 2018 at 14:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> left <a href="https://github.com/rust-lang/rust/pull/52620#pullrequestreview-139509051" target="_blank" title="https://github.com/rust-lang/rust/pull/52620#pullrequestreview-139509051">some comments on your PR</a> -- looks basically good, but I did have one concern about how we check for duplicates</p>



<a name="130154248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130154248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130154248">(Jul 23 2018 at 15:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> thanks,   I will try to update it today, just two questions:<br>
1. do I need  to add more tests like <code>vector.push(an_reference)</code> from an closure?<br>
2. I don't see anything else to do  for <a href="https://github.com/rust-lang/rust/issues/52113" target="_blank" title="https://github.com/rust-lang/rust/issues/52113">https://github.com/rust-lang/rust/issues/52113</a> , did I missed something?</p>



<a name="130154854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130154854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130154854">(Jul 23 2018 at 15:20)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> I don't know what the <code>vector.push(an_reference)</code> is referring to...</p>



<a name="130154882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130154882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130154882">(Jul 23 2018 at 15:21)</a>:</h4>
<p>I think that there is more to do for <a href="https://github.com/rust-lang/rust/issues/52113" target="_blank" title="https://github.com/rust-lang/rust/issues/52113">#52113</a>, let me see... maybe I'll try to check out your branch and test it...</p>



<a name="130154907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130154907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130154907">(Jul 23 2018 at 15:21)</a>:</h4>
<p>I imagine though that something like this might pass or fail incorrectly...</p>



<a name="130155218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130155218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130155218">(Jul 23 2018 at 15:26)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="cp">#![allow(warnings)]</span><span class="w"></span>
<span class="cp">#![feature(nll)]</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Bazinga</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Bazinga</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">F</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">produce</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="n">data</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">value</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">Bazinga</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="na">&#39;a</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">move</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">value</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">value</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="n">data</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">value</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>or maybe not that... I'm basically nervous about constraints getting created between the <code>'a</code> that results from instantiate the LBR of the parent and the <code>'a</code> that appears in the upvars.</p>



<a name="130155226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130155226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130155226">(Jul 23 2018 at 15:26)</a>:</h4>
<p>that said, it would also be interesting to see if I can concoct a test that fails with your branch as is</p>



<a name="130155251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130155251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130155251">(Jul 23 2018 at 15:27)</a>:</h4>
<p>I'm not sure if it's possible -- basically we'd want to engineer some kind of false conflict between the LBR in a closure's parameters and the LBR from the enclosing fn --</p>



<a name="130155263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130155263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130155263">(Jul 23 2018 at 15:27)</a>:</h4>
<p>given that, currently, I think the LBR in a closure sig are always anonymous</p>



<a name="130155265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130155265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130155265">(Jul 23 2018 at 15:27)</a>:</h4>
<p>that may not be possible (today)</p>



<a name="130156638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130156638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130156638">(Jul 23 2018 at 15:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  I mean </p>
<div class="codehilite"><pre><span></span>fn foo&lt;&#39;a, &#39;b&gt;(x: &amp;&#39;a u32, mut y: Vec&lt;&amp;&#39;b u32&gt;) {
  let closure = move || y.push(x);
 }
</pre></div>


<p>for <code>'a:'b</code> and <code>'b:'a</code></p>



<a name="130204046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130204046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130204046">(Jul 24 2018 at 10:54)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  your sample</p>
<blockquote>
<div class="codehilite"><pre><span></span><span class="cp">#![allow(warnings)]</span><span class="w"></span>
<span class="cp">#![feature(nll)]</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Bazinga</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Bazinga</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">F</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">produce</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="n">data</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">value</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">Bazinga</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="na">&#39;a</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">move</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">value</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">value</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="n">data</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">value</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>or maybe not that... I'm basically nervous about constraints getting created between the <code>'a</code> that results from instantiate the LBR of the parent and the <code>'a</code> that appears in the upvars.</p>
</blockquote>
<p>after change to <code>data: &amp;'a mut Vec&lt;&amp;'a u32&gt;</code> gives</p>
<div class="codehilite"><pre><span></span>15 | fn produce&lt;&#39;a&gt;(data: &amp;&#39;a mut Vec&lt;&amp;&#39;a u32&gt;, value: &amp;&#39;a u32) -&gt; impl Bazinga + &#39;a {
   |                ---- lifetime `&#39;1` appears in the type of `data`
...
18 |         data.push(value);
   |         ^^^^^^^^^^^^^^^^ argument requires that `&#39;a` must outlive `&#39;1`
</pre></div>


<p>and a sample from <a href="https://github.com/rust-lang/rust/issues/52113#issue-338985041" target="_blank" title="https://github.com/rust-lang/rust/issues/52113#issue-338985041">https://github.com/rust-lang/rust/issues/52113#issue-338985041</a> gives</p>
<div class="codehilite"><pre><span></span>8 |     let x = move || {
  |         ^ free region requires that `&#39;a` must outlive `&#39;static`
</pre></div>


<p>without nll both compile.  I'm trying to understand why...</p>



<a name="130206403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206403">(Jul 24 2018 at 11:53)</a>:</h4>
<p>ok — I suspect I know why but I'll have to try it out</p>



<a name="130206405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206405">(Jul 24 2018 at 11:54)</a>:</h4>
<p>I think my build of your branch is done</p>



<a name="130206519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206519">(Jul 24 2018 at 11:56)</a>:</h4>
<p>oh, ok, so</p>



<a name="130206520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206520">(Jul 24 2018 at 11:56)</a>:</h4>
<p>the <em>first</em> problem is this:</p>



<a name="130206526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206526">(Jul 24 2018 at 11:56)</a>:</h4>
<p>the late-bound lifetimes from the base fn are being (I believe) created at the wrong point</p>



<a name="130206529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206529">(Jul 24 2018 at 11:56)</a>:</h4>
<p>in particular, they are considered late-bound <em>on the closure itself</em></p>



<a name="130206530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206530">(Jul 24 2018 at 11:56)</a>:</h4>
<p>which is incorrect</p>



<a name="130206539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206539">(Jul 24 2018 at 11:57)</a>:</h4>
<p>this is what causes us to product the first error:</p>
<div class="codehilite"><pre><span></span>error: unsatisfied lifetime constraints
  --&gt; /Users/nmatsakis/tmp/m1.rs:11:9
   |
8  | fn produce&lt;&#39;a&gt;(data: &amp;mut Vec&lt;&amp;&#39;a u32&gt;, value: &amp;&#39;a u32) -&gt; impl Bazinga + &#39;a {
   |                ---- lifetime `&#39;1` appears in the type of `data`
...
11 |         data.push(value);
   |         ^^^^^^^^^^^^^^^^ argument requires that `&#39;a` must outlive `&#39;1`
</pre></div>



<a name="130206551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206551">(Jul 24 2018 at 11:57)</a>:</h4>
<p>in this case, the <code>'a</code> is considered a "local" region to the closure, and hence not one where we are able to propagate a "closure requirement" back to the caller</p>



<a name="130206556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206556">(Jul 24 2018 at 11:57)</a>:</h4>
<p>to fix this, we have to create those LBR from the base-def-id at a different point</p>



<a name="130206610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130206610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130206610">(Jul 24 2018 at 11:58)</a>:</h4>
<p>in particular, before <a href="https://github.com/rust-lang/rust/blob/a2af8667b1a5166137510aeb2aaad9945f81db6d/src/librustc_mir/borrow_check/nll/universal_regions.rs#L486" target="_blank" title="https://github.com/rust-lang/rust/blob/a2af8667b1a5166137510aeb2aaad9945f81db6d/src/librustc_mir/borrow_check/nll/universal_regions.rs#L486">this line executes</a></p>



<a name="130267750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130267750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130267750">(Jul 25 2018 at 10:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> ping</p>



<a name="130267886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130267886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130267886">(Jul 25 2018 at 10:45)</a>:</h4>
<p>hi <span class="user-mention" data-user-id="116009">@nikomatsakis</span> , I didn't have time to rewrite it because I need to change way how regions from inputs_output filtered out</p>



<a name="130267889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130267889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130267889">(Jul 25 2018 at 10:45)</a>:</h4>
<p>ok :)</p>



<a name="130267894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130267894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130267894">(Jul 25 2018 at 10:45)</a>:</h4>
<p>just checking in</p>



<a name="130267896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130267896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130267896">(Jul 25 2018 at 10:45)</a>:</h4>
<p>hope I will do it today</p>



<a name="130274618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130274618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130274618">(Jul 25 2018 at 13:16)</a>:</h4>
<p>let me know if I can help</p>



<a name="130300408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300408">(Jul 25 2018 at 20:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>   I'm stuck with update <code>closure_mapping</code>, cannot find a way how to add later bound regions to <code>region_mapping</code></p>



<a name="130300520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300520">(Jul 25 2018 at 20:30)</a>:</h4>
<p>because now only regions from <code>closure_ty</code> are added, and assert fails</p>



<a name="130300527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300527">(Jul 25 2018 at 20:30)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> you are trying to do the change I suggested, specifically? (That is, the reordering sort of?)</p>



<a name="130300530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300530">(Jul 25 2018 at 20:31)</a>:</h4>
<p>can I see the diff?</p>



<a name="130300650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300650">(Jul 25 2018 at 20:33)</a>:</h4>
<p>diff is almost the same, yes i made your suggestion, but after that assert inside <code>fn closure_mapping</code> starts failing</p>



<a name="130300730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300730">(Jul 25 2018 at 20:34)</a>:</h4>
<div class="codehilite"><pre><span></span>        assert_eq!(
            region_mapping.len(),
            expected_num_vars,
            &quot;index vec had unexpected number of variables&quot;);
</pre></div>



<a name="130300737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300737">(Jul 25 2018 at 20:34)</a>:</h4>
<p>would still be helpful to see the diff</p>



<a name="130300741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300741">(Jul 25 2018 at 20:34)</a>:</h4>
<p>I don't remember the details :)</p>



<a name="130300745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300745">(Jul 25 2018 at 20:34)</a>:</h4>
<p>that is, exactly wht change you made :)</p>



<a name="130300748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300748">(Jul 25 2018 at 20:35)</a>:</h4>
<p>just a sec</p>



<a name="130300964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130300964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130300964">(Jul 25 2018 at 20:39)</a>:</h4>
<p>i've updater PR <a href="https://github.com/rust-lang/rust/pull/52620" target="_blank" title="https://github.com/rust-lang/rust/pull/52620">https://github.com/rust-lang/rust/pull/52620</a></p>



<a name="130301265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301265">(Jul 25 2018 at 20:45)</a>:</h4>
<blockquote>
<p>diff is almost the same, yes i made your suggestion, but after that assert inside <code>fn closure_mapping</code> starts failing</p>
</blockquote>
<p>yes, so, this doesn't surprise me :) in fact, this is good</p>



<a name="130301269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301269">(Jul 25 2018 at 20:45)</a>:</h4>
<p>I left one comment but I don't think it'll fix your problem per se</p>



<a name="130301316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301316">(Jul 25 2018 at 20:46)</a>:</h4>
<p>but the reason that the assertion is failing -- I think -- is precisely because we're not handling the closure case correctly</p>



<a name="130301331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301331">(Jul 25 2018 at 20:46)</a>:</h4>
<p>that is, we need to upgrade the code around the <code>ClosureRegionRequirements</code></p>



<a name="130301335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301335">(Jul 25 2018 at 20:46)</a>:</h4>
<p>right now it works <em>kind of</em> implicitly</p>



<a name="130301336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301336">(Jul 25 2018 at 20:46)</a>:</h4>
<p>that is</p>



<a name="130301343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301343">(Jul 25 2018 at 20:47)</a>:</h4>
<p>there is a closure "defining type"</p>



<a name="130301354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301354">(Jul 25 2018 at 20:47)</a>:</h4>
<p>as i understand, after analysis, <code>apply_requirements</code> calls <code>closure_mapping</code> for get all external regions for <code>ClosureRegionRequirements</code>, and I need find a way how to add late bound regions, because now only regions from <code>closure_ty</code> are added</p>



<a name="130301355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301355">(Jul 25 2018 at 20:47)</a>:</h4>
<p>and we basically number the regions as they appear in there, and reference those numbers</p>



<a name="130301370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301370">(Jul 25 2018 at 20:47)</a>:</h4>
<p>right, it needs to sort of "mirror" that set so it knows how to map them</p>



<a name="130301467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301467">(Jul 25 2018 at 20:49)</a>:</h4>
<p>so annoying</p>



<a name="130301486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301486">(Jul 25 2018 at 20:49)</a>:</h4>
<p>I cannot find a function to get <code>Region</code> by <code>RegionVid</code></p>



<a name="130301491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301491">(Jul 25 2018 at 20:49)</a>:</h4>
<p>that's not really a thing</p>



<a name="130301542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301542">(Jul 25 2018 at 20:50)</a>:</h4>
<p>I'm not quite sure what you mean :)</p>



<a name="130301549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301549">(Jul 25 2018 at 20:50)</a>:</h4>
<p>you can do <code>tcx.mk_region(ty::ReVar(v2))</code></p>



<a name="130301558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301558">(Jul 25 2018 at 20:50)</a>:</h4>
<p>to create a <code>Region&lt;'tcx&gt;</code> for a given region vid-- maybe that's what you mean?</p>



<a name="130301579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301579">(Jul 25 2018 at 20:51)</a>:</h4>
<p>so one thing we could do maybe</p>



<a name="130301586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301586">(Jul 25 2018 at 20:51)</a>:</h4>
<p>After adding late_bound regions I have <code>RegionVid</code> for them, and I think I need get back <code>Region</code>s and add them to vector</p>



<a name="130301587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301587">(Jul 25 2018 at 20:51)</a>:</h4>
<p>is to have the <code>ClosureRegionRequirements</code> also include the list of late-bound regions from the parent fn that were instantiated</p>



<a name="130301642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301642">(Jul 25 2018 at 20:52)</a>:</h4>
<blockquote>
<p>After adding late_bound regions I have <code>RegionVid</code> for them, and I think I need get back <code>Region</code>s and add them to vector</p>
</blockquote>
<p>do you mean you want to get back the "named" regions? i.e., with the names from the signature?</p>



<a name="130301656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301656">(Jul 25 2018 at 20:53)</a>:</h4>
<p>if the CRR contained this list, then I guess that the <code>apply_requirements</code> code could -- when constructing this map -- basically go over each of those regions and look it up in the <code>indices</code> vector to find the corresponding <code>RegionVid</code> in the creator</p>



<a name="130301667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301667">(Jul 25 2018 at 20:53)</a>:</h4>
<p>yes, but it's just idea</p>



<a name="130301672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301672">(Jul 25 2018 at 20:53)</a>:</h4>
<p>yeah I think that's the thing to do</p>



<a name="130301679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301679">(Jul 25 2018 at 20:53)</a>:</h4>
<p>ok, so you can get back the original <code>Region</code>... well, the indices map goes the wrong way</p>



<a name="130301684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301684">(Jul 25 2018 at 20:53)</a>:</h4>
<p>we build up a reverse vector in the <code>RegionInferenceContext</code></p>



<a name="130301738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301738">(Jul 25 2018 at 20:54)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/fefe81605d6111faa8dbb3635ab2c51d59de740a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs#L274-L282" target="_blank" title="https://github.com/rust-lang/rust/blob/fefe81605d6111faa8dbb3635ab2c51d59de740a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs#L274-L282">right here</a></p>



<a name="130301770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301770">(Jul 25 2018 at 20:54)</a>:</h4>
<p>but maybe we just want to create a <code>Vec&lt;Region&gt;</code> containing all the LBR from the closure parent</p>



<a name="130301775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301775">(Jul 25 2018 at 20:54)</a>:</h4>
<p>in the <code>UniversalRegions</code></p>



<a name="130301805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301805">(Jul 25 2018 at 20:55)</a>:</h4>
<p>and then when creating the <code>ClosureRegionRequirements</code>, we would embed that vector</p>



<a name="130301813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301813">(Jul 25 2018 at 20:55)</a>:</h4>
<p>something like that?</p>



<a name="130301884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301884">(Jul 25 2018 at 20:56)</a>:</h4>
<p>(we could create the vector in the <code>replace_late_bound_regions_with_nll_infer_vars</code> that you added, I mean)</p>



<a name="130301889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130301889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130301889">(Jul 25 2018 at 20:56)</a>:</h4>
<p>yes It should help</p>



<a name="130352056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130352056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130352056">(Jul 26 2018 at 15:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> I'm looking over the list and this is one of the only major issues without a PR; were you able to make any progress? can I help in some way?</p>



<a name="130397843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130397843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130397843">(Jul 27 2018 at 09:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Sorry, I didn't received a notification about your message. I tried to pass a vector with regions from <code>replace_late_bound_regions_with_nll_infer_vars</code>to <code>apply_requirements</code> I didn't find a way,  because <code>UniveralRegions</code> from closure analysis is already destroyed and I have only <code>ClosureRegionRequirements&lt;'gcx&gt;</code> maybe I should try just to get regions again by <code>tcx.is_late_bound_map</code> and recreate <code>ty::Region</code>s.  In any case I hope I will have enough time during  weekend to fix it.</p>



<a name="130403440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130403440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikhail-m1 <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130403440">(Jul 27 2018 at 11:16)</a>:</h4>
<p>It works! I need to cleanup my code, I will update the PR today or tomorrow.</p>



<a name="130449999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51351/near/130449999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51351.html#130449999">(Jul 28 2018 at 04:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116925">@mikhail-m1</span> nice!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>